package com.breakfast.fun.ui.user.feedback;

import android.widget.Button;
import android.widget.EditText;

import com.breakfast.fun.R;
import com.breakfast.fun.base.BaseActivity;
import com.breakfast.fun.util.T;
import com.breakfast.fun.view.widget.TitleBarView;

import butterknife.Bind;

public class OrderFeedBackActivity extends BaseActivity<OrderFeedBackPresenter, OrderFeedBackModel> implements OrderFeedBackContract.View {

    @Bind(R.id.tbv_orde_feedback)
    TitleBarView mTbvOrdeFeedback;
    @Bind(R.id.et_order_feedback_content)
    EditText mEtOrderFeedbackContent;
    @Bind(R.id.btn_order_feedback)
    Button mBtnOrderFeedback;

    @Override
    public int getLayoutId() {
        return R.layout.activity_order_feed_back;
    }

    @Override
    public void initView() {
        mTbvOrdeFeedback.setBack(this);
        mTbvOrdeFeedback.setTitleNoRight("订单投诉");
        mBtnOrderFeedback.setOnClickListener(v -> {
            if (mEtOrderFeedbackContent.getText().length() == 0) {
                T.show("请填写反馈内容");
                return;
            }
            presenter.submitFeed(getIntent().getStringExtra("orderId"), mEtOrderFeedbackContent.getText().toString());
        });
    }

    @Override
    public void feedSuccess() {
        T.show("反馈成功");
        finish();
    }
}
